import postApi from "../../utils/http/api";
import postApiNew from "../../utils/http/api-new";

export default {
  //6.1 开通企业大学(门店) type(门店加盟：2 / 普通企业：1)
  createUniversity(data) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/create",
      requestData: data,
    })
  },
  //6.2 获取企业大学信息(门店信息)
  getTeamInfo(teamId) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/getInfo",
      requestData: {
        targetEnterpriseId: teamId,
      },
    })
  },
  //6.3 修改企业大学信息(门店信息)
  modifyTeamInfo(data) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/updateInfo",
      requestData: data
    })
  },
  //6.4 企业下门店列表
  getTeamList() {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/list",
      requestData: {
      },
    })
  },
  //6.1.0 所处团队自己的信息
  getMyTeamUser() {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/hftuser/getInfo",
      requestData: {
      },
    })
  },
  //6.1.1 门店成员列表
  getTeamMember(teamId) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/user/list",
      requestData: {
        targetEnterpriseId: teamId,
      },
    })
  },
  //6.1.2 管理员移除普通成员
  kickMember(userId) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/user/remove",
      requestData: {
        targetUserid: userId
      },
    })
  },
  //6.1.3 普通成员退出门店
  quitTeam() {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/user/quit",
      requestData: {
      },
    })
  },
  //6.1.4 超级管理员踢人
  superKickMember(userId) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/user/adminRemove",
      requestData: {
        "targetUserid": userId,
      },
    })
  },
  //6.1.5 超级管理员任命管理员
  superSetManager(userId) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/user/adminAddManger",
      requestData: {
        "targetUserid": userId,
      },
    })
  },
  //6.1.6 超级管理员修改员工归属分布
  superMoveMember(userId, enterpriseId) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/user/adminMoveMember",
      requestData: {
        "targetUserid": userId,
        "targetEnterpriseId": enterpriseId
      },
    })
  },

  //获取成员学习记录
  getMemberHistory(targetUserId, page, size = 10) {
    return postApi({
      actionCode: "100300",
      method: "getMemberStudiesSubjectRecord",
      requestData: {
        targetUserId: targetUserId,
        page: page,
        size: size
      },
    })
  },
  //获取成员证书列表
  getMemberCert(targetUserId) {
    return postApi({
      actionCode: "500101",
      method: "getUserReceiveCertificateList",
      requestData: {
        targetUserid: targetUserId
      },
    })
  },
  //获取邀请码
  getInviteCode(teamId) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/user/getInviteCode",
      requestData: {
        "targetEnterpriseId": teamId,
      },
    })
  },
  //更新邀请码
  updateInviteCode(teamId) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/user/resetInviteCode",
      requestData: {
        "targetEnterpriseId": teamId,
      },
    })
  },
  //加入团队
  joinTeam (code, username) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/user/addByInviteCode",
      requestData: {
        "inviteCode": code,
        "username": username
      },
    })
  },
  //数据统计
  getChartData(teamId) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/statistics/statisticsData",
      requestData: {
        "targetEnterpriseId": teamId,
      },
    })
  },
  //管理员数据统计
  getManagerChartData() {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/statistics/statisticsDataAdmin",
      requestData: {
      },
    })
  },
  //通过userId获取用户列表
  modifyManagerPermission(userId, permission) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/user/adminModifyPermission",
      requestData: {
        "targetUserid": userId,
        "permission": permission,
      },
    })
  },
  //通过targetId获取团队信息 分享界面用
  getSharePageTeamInfo(teamId, inviteRec) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/getSimpleInfo",
      requestData: {
        targetEnterpriseId: teamId,
        inviteRec: inviteRec
      },
    })
  },
  disbandFreeEnterprise() {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/user/disbandFreeEnterprise",
      requestData: {},
    })
  },


  //6.3.1.1 员工学习值排行榜
  learnValueList(teamId,isSummary,page = 1,size=10) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/statistics/user/learnValueListCache",
      requestData: {
        targetEnterpriseId: teamId,
        isSummary : isSummary
      },
      page: page,
      size: size,
    })
  },

  //6.3.1.2 员工课程排行榜
  courseCntList(teamId,isSummary,page=1,size=10) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/statistics/user/subjectCntList",
      requestData: {
        targetEnterpriseId: teamId,
        isSummary : isSummary
      },
      page: page,
      size: size,
    })
  },


  //6.3.1.3 员工证书排行榜
  certCntList(teamId,isSummary,page = 1,size= 10) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/statistics/user/certCntList",
      requestData: {
        targetEnterpriseId: teamId,
        isSummary : isSummary
      },
      page: page,
      size: size,
    })
  },


  //6.3.2.1 企业学习值排行榜
  learnValueListTeam(teamId,page=1,size = 10) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/statistics/team/learnValueListCache",
      requestData: {
        targetEnterpriseId: teamId,

      },
      page: page,
      size: size,
    })
  },

  //6.3.2.2 企业课程排行榜
  courseCntListTeam(teamId,page = 1,size = 10) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/statistics/team/subjectCntList",
      requestData: {
        targetEnterpriseId: teamId,

      },
      page: page,
      size: size,
    })
  },



  //6.3.2.3 企业证书排行榜
  certCntListTeam(teamId,page = 1,size = 10) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/statistics/team/certCntList",
      requestData: {
        targetEnterpriseId: teamId,

      },
      page: page,
      size: size,
    })
  },

  //6.3.2.4 测试通过率
  getExamRatio(teamId, isSummary) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/statistics/team/examResult",
      requestData: {
        targetEnterpriseId: teamId,
        isSummary : isSummary
      },
    })
  },

  //6.3.2.5 漏斗数据
  getFunnelData(teamId, isSummary) {
    return postApiNew({
      actionCode: "zhiye-user",
      path: "/enterprise/statistics/team/funnel",
      requestData: {
        targetEnterpriseId: teamId,
        isSummary : isSummary
      },
    })
  },


}
